package ch.usi.inf.pf2;

import java.io.IOException;

/**
 * 
 * @author Lorenzo Baracchi
 * 
 */
public class TestReadWriteFile
{
    // manual test
    public static void main(String[] args)
    {
	   Sheet s = new Sheet();
	   s.initializeSheet();
	   s.insertDataAtCell("a", 1, 1); // A1
	   s.insertDataAtCell("2", 1, 2); // B1
	   s.insertDataAtCell("=A1+A2", 2, 1); // A2
	   WriteSpreadSheetFile spread = new WriteSpreadSheetFile(s, "testWrite");
	   spread.writeSheet();
	   SpreadSheetPrinter sp = new SpreadSheetPrinter(s);
	   // sp.print();

	   ReadSpreadSheetFile rssf = new ReadSpreadSheetFile("testWrite");
	   Sheet t = new Sheet();
	   try
	   {
		  t = rssf.readSheet();
	   } catch (IOException e)
	   {
		  System.out.println("File not found");
		  e.printStackTrace();
	   }
	   sp = new SpreadSheetPrinter(t);
	   sp.print();
    }
}
